package day3.HomeWork;

/**
 * ClassName：Master
 *
 * @Author：小鱼
 * @Create：2025-08-21 10:55
 */
public class Master extends Thread{
    private Bum bum1;
    private Bum bum2;

    public Master(String name,Bum bum1,Bum bum2) {
        super(name);
        this.bum1 = bum1;
        this.bum2 = bum2;
    }

    @Override
    public void run(){
        while (true){
            synchronized (bum1){
                bum1.count++;
                System.out.println("生产了肉包子"+bum1.count);
                bum1.notifyAll();
            }
            synchronized (bum2){
                bum2.count++;
                System.out.println("生产了蔬菜包子"+bum2.count);
                bum2.notifyAll();
            }

        }
    }
}
